package Com.amit.Collection;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;

public class Lab1 {

	
	public static void main(String[] args) {
		
		ArrayList al=new ArrayList();
		al.add(new Integer(20));
		al.add(new Integer(0));
		al.add(new Integer(2));
		al.add(-1);
		al.add(6);
		
		Collections.sort(al);
		
		Iterator itr=al.iterator();
		
		while(itr.hasNext())
		{
			System.out.println(itr.next());
		}
System.out.println("by for each loop");

for(Object i:al)
{
	System.out.println(i);
}
	}

}
